package com.mysoft.gfyx.clue.service.impl;

import com.mysoft.framework.common.user.User;
import com.mysoft.framework.core.function.authorization.AuthenticationUser;
import com.mysoft.framework.service.AppService;
import com.mysoft.gfyx.clue.dao.UserBehaviourDao;
import com.mysoft.gfyx.clue.dao.entity.UserBehaviour;
import com.mysoft.gfyx.clue.service.UserBehaviourService;
import com.mysoft.sdk.context.core.ThreadContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 描述：CustomerPool客户池管理服务 业务代码
 *
 * @author JavaSdk generator
 * @date 2022-11-15
 */
@Service
public class UserBehaviourServiceImp extends AppService implements UserBehaviourService {

    @Autowired
    private UserBehaviourDao userBehaviourDao;

    @Override
    public UserBehaviour addUserBehaviour(String menuName, String tabName, String actionName, String actionRemark) {
        User authenticationUser = ThreadContextHolder.getInstance().get(AuthenticationUser.class);
        UserBehaviour userBehaviour = new UserBehaviour();
        userBehaviour.setMenuName(menuName);
        userBehaviour.setTabName(tabName);
        userBehaviour.setActionName(actionName);
        userBehaviour.setActionRemark(actionRemark);
        userBehaviour.setOperationUserGUID(authenticationUser.getUserId());
        userBehaviourDao.insert(userBehaviour);
        return userBehaviour;
    }

}